{% extends 'common/default.html' %}
{% block common %}
<script type="text/javascript">
	function courseDelete(id){
	    alert(id)
		if(confirm("确认要删除这条记录吗？")){
			$.post("../manager/manager_delete",{id:id},
				function(result){
					//var result=eval('('+result+')');
					if(result=="success"){
						alert("删除成功!");
						window.location.href="../manager/course_list";
					}else{
					    alert(result)
						//alert("该课程有学生在选，不能删除");
					}
				}
			);
		}
	}
</script>
<div class="row search" >
  <div class="col-md-6">
	<form action="../manager/manager_search" method="post">

	    <div class="input-group" style="width: 300px">
		      <input type="text" class="form-control" name="content"  placeholder="请输入要查询的课程名称...">
		      <span class="input-group-btn">
		        <button class="btn btn-default" type="submit"><span class="glyphicon glyphicon-search"></span>&nbsp;查询</button>
		      </span>
	    </div>
    </form>
  </div>
  <div class="col-md-6" >
    <button type="button"  style="float: right;" class="btn btn-primary" onclick="javascript:window.location.href='../manager/manager_add'">添加</button>
  </div>
</div>
<div>
	<table class="table table-hover  table-bordered table-striped" style="margin-bottom: 0px;">
		<tr>
		  	<th>序号</th>
		  	<th>课程名称</th>
		  	<th>学分</th>
		  	<th>授课老师</th>
            <th>详情</th>
		  	<th>操作</th>
		  </tr>
{% for course in datas %}
    <tr>
		  	    <td>{{course.id }}</td>
		  		<td>{{course.courseName }}</td>
		  		<td>{{course.credit }}</td>
		  		<td>{{course.teacherId.trueName }}</td>
                <td><a href="../course_update/?course_id={{ course.id }}">点击修改</a></td>
		  		<td><button type="button" class="btn btn-danger btn-xs" onclick="courseDelete({{course.id }})">删除</button></td>
		  	</tr>
{% endfor %}

	</table>
	<nav >
		<ul class="pagination">

		</ul>
	</nav>
</div>
{% endblock %}


